/* eslint-disable no-unused-vars */
const funcsModel = require('../../../functions');
const DefaultDataAdapter = require('./../default-report/target-machine-data-adapter');

class DataAdapter extends DefaultDataAdapter {
  async getBlackBoxCovered(functionId) {
    if (!this.functions.has(functionId.toString())) {
      return [];
    }
    return [{ _id: '1', coveredFields: this.functions.get(functionId.toString()).coveredFields }];
  }

  async getWhiteBoxCovered(functionId) {
    return [];
  }

  async getManualCovered(functionId) {
    return [];
  }

  async getFunctionCfg(func, includeCovered = true) {
    let funcCfg = await funcsModel.getFunctionCFG(func._id, null, false);
    if (!includeCovered) {
      return funcCfg;
    }
    if (func.coveredFields) {
      funcCfg = funcsModel.mergeCfgCovered(funcCfg, func.coveredFields);
    }
    return funcsModel.completeDecisionCases(funcCfg, this.version.mcdcKind);
  }
}

module.exports = DataAdapter;
